<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="{{asset('resources/views/admin/Flat/dist/css/vendor/bootstrap.min.css')}}" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="{{asset('resources/views/admin/Flat/dist/css/flat-ui.css')}}" rel="stylesheet">
	    <link href="{{asset('resources/views/admin/Flat/docs/assets/css/demo.css')}}" rel="stylesheet">
	    <link rel="shortcut icon" href="{{asset('resources/views/admin/Flat/img/favicon.ico')}}">
	    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
		<script src="{{asset('resources/views/admin/assets/global/plugins/jquery.min.js')}}" type="text/javascript"></script>
		<script src="{{asset('resources/org/layer/layer.js')}}"></script>
	</head>
	<body>
		<table class="table table-hover">
			<tr class="active">
			  <th width="30">aid</th>
			  <th>门店名称</th>
			  <th>所属城市</th>
			  <th>门店地址</th>
			  <th>营业时间</th>
			  <th>公交路线</th>
			  <th>评价</th>
			  <th width="200">操作</th>
			</tr>
			@foreach($data as $k=>$v)
			<tr>
				<td>{{$v->menid}}</td>
				<td>{{$v->mname}}</td>
				<td>{{$v->cityname}}</td>
				<td>{{$v->m_address}}</td>
				<td>{{$v->businessTime}}</td>
				<td>{{$v->Busroute}}</td>
				<td>{{$v->evaluate}}</td>
				<td>
					<a href="{{url('admin/store/'.$v->menid.'/edit')}}" class="btn btn-sm btn-warning">编辑</a>
					<a href="javascript:;" menid="{{$v->menid}}" class="btn btn-sm btn-danger">删除</a>
				</td>
			</tr>
			@endforeach
		</table>
		<script>
			$(function () {
				//抓到删除键
				$('.btn-danger').click(function () {
					//抓取要删除的门店id
					var $menid = $(this).attr('menid');

					//调用删除
					delstore($menid);


				})
				//定义弹窗
				function delstore($menid) {
					layer.confirm('确定删除门店吗？', {
						btn: ['是的','取消'] //按钮
					}, function(){
						$.post("{{url('admin/store')}}/"+$menid,{'_method':'delete','_token':"{{csrf_token()}}"},function (data) {
							if(data.status ==0){
								location.href = location.href;
								layer.msg(data.msg,{icon:6});
							}else{
								layer.msg(data.msg,{icon:5});
							}
						})
						//layer.msg('删除成功', {icon: 1});
					}, function(){

					});

				}

			})
		</script>
		
		<style type="text/css">
			.page li{
				margin-right: 0;
			}
		</style>
		<center>
			<div class="page pagination">
				<ul>

				</ul>
			</div>
		</center>	
	</body>
</html>
